import { getTopBanners } from "@/api/recommend";
import { CHANGE_TOP_BANNERS } from "./constants";

const changeTopBannersAction = payload => ({
  type: CHANGE_TOP_BANNERS,
  payload,
});

export const getTopBannersAction = () => {
  return dispatch => {
    getTopBanners().then(res => {
      dispatch(changeTopBannersAction(res.banners));
    });
  };
};
